home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form FrmNewService
- BorderStyle = 3 'Fixed Dialog
- Caption = "New Service"
- ClientHeight = 2955
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4680
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2955
- ScaleWidth = 4680
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.CommandButton btnCancel
- Caption = "Cancel"
- Height = 375
- Left = 1920
- TabIndex = 11
- Top = 2460
- Width = 1275
- End
- Begin VB.CommandButton btnCreate
- Caption = "Create"
- Height = 375
- Left = 3300
- TabIndex = 10
- Top = 2460
- Width = 1275
- End
- Begin VB.Frame Frame1
- Caption = "Startup type"
- Height = 855
- Left = 60
- TabIndex = 6
- Top = 1440
- Width = 4515
- Begin VB.OptionButton rbnDisabled
- Caption = "Disabled"
- Height = 195
- Left = 3120
- TabIndex = 9
- Top = 360
- Width = 1155
- End
- Begin VB.OptionButton rbnManual
- Caption = "Manual"
- Height = 195
- Left = 1620
- TabIndex = 8
- Top = 360
- Width = 1155
- End
- Begin VB.OptionButton rbnAutomatic
- Caption = "Automatic"
- Height = 195
- Left = 180
- TabIndex = 7
- Top = 360
- Value = -1 'True
- Width = 1155
- End
- End
- Begin VB.TextBox edtFileName
- Height = 375
- Left = 1380
- TabIndex = 5
- Top = 900
- Width = 3255
- End
- Begin VB.TextBox edtDisplayName
- Height = 375
- Left = 1380
- TabIndex = 3
- Top = 480
- Width = 3255
- End
- Begin VB.TextBox edtServiceName
- Height = 375
- Left = 1380
- TabIndex = 1
- Top = 60
- Width = 3255
- End
- Begin VB.Label Label3
- Caption = "Binary file name"
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 1020
- Width = 1155
- End
- Begin VB.Label Label2
- Caption = "Display name"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 540
- Width = 1155
- End
- Begin VB.Label Label1
- Caption = "Service name"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 1155
- End
- Attribute VB_Name = "FrmNewService"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub btnCancel_Click()
- Unload FrmNewService
- End Sub
- Private Sub btnCreate_Click()
- On Error GoTo ErrorHandler
- Set NTService = FrmServiceManager.NTServiceX
- NTService.ManagerAccess = M_CONNECT + M_CREATE_SERVICE
- NTService.ServiceType = WIN32_OWN_PROCESS
- NTService.ErrorControl = ERROR_NORMAL
- NTService.ServiceName = edtServiceName.Text
- NTService.DisplayName = edtDisplayName.Text
- NTService.BinaryPathName = edtFileName.Text
- NTService.ServiceStartName = "LocalSystem"
- If rbnAutomatic.Value = True Then NTService.StartType = AUTO_START
- If rbnManual.Value = True Then NTService.StartType = DEMAND_START
- If rbnDisabled.Value = True Then NTService.StartType = DISABLED
- NTService.ActiveManager = True
- MsgBox ("The service has been created successefuly.")
- NTService.Createservice
- ExitProc:
- NTService.ActiveManager = False
- Unload FrmNewService
- Exit Sub
- ErrorHandler:
- MsgBox (Err.Description)
- Resume ExitProc
- End Sub
-